package reflect;

import java.lang.reflect.Method;

public class ReflectDemo5 {
    public static void main(String[] args) throws Exception, IllegalAccessException {
        Class cls=Class.forName("reflect.Person");
        Object obj=cls.newInstance();
        Method mtd=cls.getMethod("say", String.class);
        mtd.invoke(obj,"我是****");

        Method mtd2=cls.getMethod("say", String.class,int.class);
        mtd2.invoke(obj,"我是****",3);
    }

}
